﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PServiceBus.Core.Runtime.Topics {
    /// <summary>
    /// Instance for defining contract for ITopic
    /// </summary>
    [Serializable]
    public class TopicContract {
        /// <summary>
        /// Gets or sets the name of the contract usually the same as the ITopic Name.
        /// </summary>
        /// <value>The name.</value>
        public string Name { get; set; }
        /// <summary>
        /// Gets or sets the description of IEvent. Description is provided to subscriber querying for available topic.
        /// Should be descriptive and explain what the topic does
        /// </summary>
        /// <value>The description.</value>
        public string Description { get; set; }
        /// <summary>
        /// Gets or sets the parameter infos.
        /// Contains parameters that would be provided by topic when publisher publish it
        /// </summary>
        /// <value>The parameter infos.</value>
        public IList<TopicParameterInfo> ParameterInfos { get; set; }
        /// <summary>
        /// Create a new instance of the Contract
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="description">The description.</param>
        /// <returns></returns>
        public static TopicContract New(string name, string description) {
            return new TopicContract() { Name = name, Description = description, ParameterInfos = new List<TopicParameterInfo>() };
        }
    }
}
